package com.tom.architect.party3.day26.okhttp;

/**
 *
 */
public class OkHttpClient {
    final Dispatcher dispatcher;

    // 防止外界调用
    private OkHttpClient(Builder builder) {
        dispatcher = builder.dispatcher;
    }
    // 给外界调用
    public OkHttpClient() {
        this(new Builder());
    }

    public Call newCall(Request request) {
        return RealCall.newCall(request, this);
    }

    public static class Builder {
        Dispatcher dispatcher;
        // 连接超时，https 的证书参数, 拦截器 ...

        public Builder() {
            dispatcher = new Dispatcher();
        }

        public OkHttpClient build() {
            return new OkHttpClient(this);
        }
    }


}
